package org.tigris.subversion.svnant.commands;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.tigris.subversion.svnant.SvnAntUtilities;
import org.tigris.subversion.svnclientadapter.ISVNClientAdapter;
import org.tigris.subversion.svnclientadapter.SVNClientException;
import org.tigris.subversion.svnclientadapter.SVNStatusKind;

public class Commit extends ResourceSetSvnCommand
{
  private static final String MSG_CANT_COMMIT_RESOURCES = "Can't commit resources !";
  private String message = null;
  private List<File> recursivecommit = new ArrayList();
  private List<File> nonrecursivecommit = new ArrayList();

  public Commit()
  {
    super(true, true, true, SVNStatusKind.ADDED);
  }

  protected void handleBegin()
  {
    this.recursivecommit.clear();
    this.nonrecursivecommit.clear();
  }

  protected void handleUnmanaged(File paramFile)
  {
    this.nonrecursivecommit.add(paramFile);
  }

  protected void handleDir(File paramFile, boolean paramBoolean)
  {
    if (paramBoolean)
      this.recursivecommit.add(paramFile);
    else
      this.nonrecursivecommit.add(paramFile);
  }

  protected void handleFile(File paramFile)
  {
    this.nonrecursivecommit.add(paramFile);
  }

  protected void handleEnd()
  {
    if (!this.nonrecursivecommit.isEmpty())
      try
      {
        File[] arrayOfFile1 = (File[])this.nonrecursivecommit.toArray(new File[this.nonrecursivecommit.size()]);
        getClient().commit(arrayOfFile1, this.message, false);
      }
      catch (SVNClientException localSVNClientException1)
      {
        throw ex(localSVNClientException1, "Can't commit resources !", new Object[0]);
      }
    if (!this.recursivecommit.isEmpty())
      try
      {
        File[] arrayOfFile2 = (File[])this.recursivecommit.toArray(new File[this.recursivecommit.size()]);
        getClient().commit(arrayOfFile2, this.message, true);
      }
      catch (SVNClientException localSVNClientException2)
      {
        throw ex(localSVNClientException2, "Can't commit resources !", new Object[0]);
      }
  }

  protected void validateAttributes()
  {
    super.validateAttributes();
    SvnAntUtilities.attrNotEmpty("message", this.message);
  }

  public void setRecurse(boolean paramBoolean)
  {
    super.setRecurse(paramBoolean);
  }

  public void setMessage(String paramString)
  {
    this.message = paramString;
  }
}

/* Location:           C:\Users\Administrator\Desktop\svnant.jar
 * Qualified Name:     org.tigris.subversion.svnant.commands.Commit
 * JD-Core Version:    0.6.0
 */